package com.kaifamiao.www.IP.do0928;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class UDPReceive {
    public static void main(String[] args) throws IOException {
        byte[] bytes = new byte[1024];
        DatagramPacket packet = new DatagramPacket(bytes,1024);

        DatagramSocket socket = new DatagramSocket(8888);
        socket.receive(packet);
        String message =new String(packet.getData(),0,packet.getLength());
        System.out.println(packet.getAddress().getHostAddress() + message);


    }
}
